package com.simple.demo.io.nio;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class NIOFile {

    public static void main(String[] args) throws IOException {
        Path path = Paths.get("D:\\temp\\111.txt");
        System.out.println(path.getFileName());
        byte [] bytes = Files.readAllBytes(path);
        System.out.println(new String(bytes));

        BufferedReader buff = Files.newBufferedReader(path);
        char [] charb = new char[256];
        int readLen = 0 ;
        while((readLen = buff.read(charb)) > 0){
            System.out.println(new String(charb,0,256));
            System.out.println("-------------------------------------------------------");
        }




    }
}
